package cn.com.qiancheng.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import cn.com.qiancheng.util.DbUtil;

public class DeleteStuDao {
	public int deleteStudent(String userName) {
		int i = 0;
		try {
			Connection con = DbUtil.openConnection();
			String sql = "DELETE  FROM t_students WHERE stu_user_name = ?";
			PreparedStatement stam = con.prepareStatement(sql);
			stam.setString(1, userName);
			i = stam.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			try {
				DbUtil.closeConnection();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}

		return i;
	}
}
